package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.TaotaoResult;
import com.taotao.common.TreeResult;
import com.taotao.service.ContentCatagoryService;

@Controller
public class ContentCatagoryController {
	@Autowired
	private ContentCatagoryService contentCatagoryService;
	@RequestMapping("/content/category/list")
	@ResponseBody
	public List<TreeResult> getContentCata(@RequestParam(value="id",defaultValue="0") long parentId){
		List<TreeResult> list=contentCatagoryService.getContentCatogorys(parentId);
		return list;
	}
	
	@RequestMapping(value="/content/category/create",method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult insertContentCata(Long parentId,String name){
		TaotaoResult taotaoResult = contentCatagoryService.insertContentCatagory(parentId, name);
		return taotaoResult;
	}
}
